﻿
/*
 * Update the schema of the table UDS_Flow_Path
 */
 
/*
1. Drop PK:
If the doc can get approved by more than 1 members, the order column will be the same.
As a result, it breaks the PK constraint.
 */
IF object_id(N'dbo.[PK_UDS_Flow_Path]') IS NOT NULL
    ALTER TABLE [dbo].[UDS_Flow_Path] DROP CONSTRAINT [PK_UDS_Flow_Path];
GO


IF EXISTS ( SELECT 1 FROM sys.indexes WHERE [name] = N'CX_UDS_Flow_Path_Order' )
    DROP INDEX [CX_UDS_Flow_Path_Order] ON dbo.UDS_Flow_Path;

CREATE CLUSTERED INDEX [CX_UDS_Flow_Path_Order] ON dbo.UDS_Flow_Path (Doc_ID asc, Order_ID asc);
GO